void WindowUP_BarLED(E_LED_POS led_position)
{
	IO_PinWrite(LedUP, ON);
	
	switch (led_position)
	{
		case LEDPOS_0:
		{
			IO_PinWrite(Led0, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_1:
		{
			IO_PinWrite(Led1, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_2:
		{
			IO_PinWrite(Led2, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_3:
		{
			IO_PinWrite(Led3, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_4:
		{
			IO_PinWrite(Led4, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_5:
		{
			IO_PinWrite(Led5, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_6:
		{
			IO_PinWrite(Led6, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_7:
		{
			IO_PinWrite(Led7, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_8:
		{
			IO_PinWrite(Led8, ON);
			delay_ms(400);
			break;
		}
		case LEDPOS_9:
		{
			IO_PinWrite(Led9, ON);
			delay_ms(400);
			break;
		}
		default:
		{
			break;
		}	
	}
	IO_PinWrite(LedUP, OFF);
}


/* ---- function to simulate the window is lowered ---- */
void WindowDOWN_BarLED(E_LED_POS led_position)
{
	IO_PinWrite(LedDWN, ON);
	
	switch (led_position)
	{
		case LEDPOS_1:
		{
			IO_PinWrite(Led0, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_2:
		{
			IO_PinWrite(Led1, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_3:
		{
			IO_PinWrite(Led2, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_4:
		{
			IO_PinWrite(Led3, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_5:
		{
			IO_PinWrite(Led4, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_6:
		{
			IO_PinWrite(Led5, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_7:
		{
			IO_PinWrite(Led6, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_8:
		{
			IO_PinWrite(Led7, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_9:
		{
			IO_PinWrite(Led8, OFF);
			delay_ms(400);
			break;
		}
		case LEDPOS_10:
		{
			IO_PinWrite(Led9, ON);
			delay_ms(400);
			break;
		}
		default:
		{
			break;
		}	
	}
	IO_PinWrite(LedDWN, OFF);
}


/* Function to obtain checksum */
T_UBYTE CheckSum_Function(T_UBYTE WUP_data, T_UBYTE command)
{
	T_UBYTE lub_result;
	T_UBYTE lub_partial_result_LS = 0x00;
	T_UBYTE	lub_partial_result_MS = 0x00;
	T_UBYTE	lub_wupdata_nibble0, lub_wupdata_nibble1;
	T_UBYTE	lub_command_nibble0, lub_command_nibble1;
	
	lub_wupdata_nibble0 = (WUP_data >> 4) & MASK_TO_NIBBLE;
	lub_wupdata_nibble1 = WUP_data & MASK_TO_NIBBLE;
	
	lub_command_nibble0 = (command >> 4) & MASK_TO_NIBBLE;
	lub_command_nibble1 = command & MASK_TO_NIBBLE;
	
	lub_partial_result_LS = lub_wupdata_nibble0 ^ lub_wupdata_nibble1;
	lub_partial_result_LS ^= lub_command_nibble0;
	lub_partial_result_LS ^= lub_command_nibble1;
	
	lub_partial_result_MS = (T_UBYTE)(~lub_partial_result_LS) & MASK_TO_NIBBLE;
	lub_partial_result_MS <<= 4;
	
	lub_result = lub_partial_result_MS | lub_partial_result_LS;
	
	return lub_result;
}